﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Garlic.BLL.Common;
using DAL.SystemManagement;
using Garlic.DM.DataModel;

namespace BLL.SystemManagement
{
    public class VesselsBLL : BaseManager
    {
        #region private fields
        VesselsDAL vesselDal = new VesselsDAL();

        #endregion

        #region old

        /// <summary>
        /// 根据船公司或者船代理ID获取船舶信息
        /// </summary>
        /// <param name="companyID"></param>
        /// <returns></returns>
        public static DataTable GetVesselsByCompany(string companyID)
        {
            return DAL.SystemManagement.VesselsDAL.GetVesselsByCompany(companyID);
        }

        public static DataTable GetAllVessels()
        {
            return VesselsDAL.GetAllVessels();
        }

        public static DataTable GetVesselsByID(int vsl_id)
        {
            return VesselsDAL.GetVesselsByID(vsl_id);
        }

        //public static DataTable GetLinersByFLT_ID(int flt_id)
        //{
        //    return VesselsDAL.GetLinersByFLT_ID(flt_id);
        //}

        public static int InsertLiners(string lnr_vsl_cd, int lnr_flt_id, int? lnr_istep, int? lnr_estep, string lnr_ivoyage, string lnr_evoyage, string lnr_insertuser, int lnr_vsl_id, int? lnr_iamount, int? lnr_eamount)
        {
           return  VesselsDAL.InsertLiners(lnr_vsl_cd, lnr_flt_id, lnr_istep, lnr_estep, lnr_ivoyage, lnr_evoyage, lnr_insertuser, lnr_vsl_id, lnr_iamount, lnr_eamount);
        }

        public string InsertUpdateDeleteOperation(int operationType, int userID, WEB_VM_LINERS model)
        {
            VesselsDAL dal = new VesselsDAL();
            return dal.InsertUpdateDeleteOperation(operationType, userID, model);
        }

        public static int Delete_st_liners(int lnr_id)
        {
            return VesselsDAL.Delete_st_liners(lnr_id);
        }

        public static int Update_st_liners(int lnr_id, string lnr_ivoyage, string lnr_evoyage, string lnr_istep, string lnr_iamount, string lnr_eamount, string lnr_estep, string lnr_lstupuser)
        {
            return VesselsDAL.Update_st_liners(lnr_id,lnr_ivoyage, lnr_evoyage,lnr_istep,lnr_iamount,lnr_eamount, lnr_estep,lnr_lstupuser);
        }

        public static DataTable GetLinersByFLT_ID(int? flt_id, int?agentID)
        {
            return VesselsDAL.GetLinersByFLT_ID(flt_id, agentID);
        }

        #endregion

        #region new


        /// <summary>
        /// 获取vessel信息
        /// </summary>
        /// <param name="strWhere"></param>
        /// <param name="strOrder"></param>
        /// <returns></returns>
        public DataTable GetTable(string strWhere, string strOrder)
        {
            return vesselDal.GetTable(strWhere, strOrder);
        }

        #endregion
    }
}
